package com.roger.bt.trans.ser.receiver;

import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.roger.bt.trans.ser.BtBase;
import com.roger.bt.trans.ser.util.Logger;

public class BtReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
        if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) {
            Logger.log(BtBase.FILE_PATH +"monitor.txt","onReceive: connect to " + device.getName());
        } else if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
            Logger.log(BtBase.FILE_PATH +"monitor.txt","onReceive: disconnect with " + device.getName());
        }
    }

}
